﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vanfa.Queries.Sql.DbModel;
using Vanfa.Entities.User;

namespace Vanfa.Biz.User
{
    static partial class BizConvertor
    {
        public static vCode ToBizEntity(this userCheckCode code)
        {
            if (code == null)
                return null;
            var vc = new vCode
            {
                Mobile = code.Mobile,
                Code = code.Code,
                Expire = code.Expiration
            };
            return vc;
        }

        public static vUserPrivInfo ToBizEntity(this userMemberInfo_Private profile)
        {
            if (profile == null)
                return null;
            var bizProfile = new vUserPrivInfo
            {
                Birthday = profile.Birthday,
                FullName = profile.FullName,
                Location = profile.HomeTown,
                Icon = profile.IconPath,
                IDCard = profile.IDCard,
                NickName = profile.NickName,
                UserID = profile.UserID
            };
            return bizProfile;
        }

        public static vUserGroupInfo ToBizEntity(this userMemberInfo_Group profile)
        {
            if (profile == null)
                return null;
            var bizProfile = new vUserGroupInfo
            {
                Agent = profile.Agent,
                FunDate = profile.FoundTime,
                GourpName = profile.GroupName,
                GroupType = profile.GroupType,
                IDCard = profile.IDCard,
                GroupCount = profile.MemberCount,
                UserID = profile.UserID,
                Icon = profile.IconPath
            };
            return bizProfile;
        }
    }
}
